﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace The_LarX
{
    public static class MatrixUtil
    {
        /// <summary>
        /// Returns a Rotation Matrix with the Rotation Converted to Radians
        /// </summary>
        /// <param name="RotationInDegrees"></param>
        /// <returns></returns>
        public static Matrix DegreesVectorToMatrix(Vector3 RotationInDegrees)
        {
            return Matrix.CreateFromYawPitchRoll(MathHelper.ToRadians(RotationInDegrees.Y),
                MathHelper.ToRadians(RotationInDegrees.X),
                MathHelper.ToRadians(RotationInDegrees.Z));
        }

        /// <summary>
        /// Returns a World Matrix. The correct order of multiplication is Scale * Rotation * Translation
        /// </summary>
        /// <param name="scale"></param>
        /// <param name="rotation"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public static Matrix CreateWorldMatrix(Matrix scale, Matrix rotation, Matrix trans)
        {
            return scale * rotation * trans;
        }

        /// <summary>
        /// Returns a Rotation Matrix
        /// </summary>
        /// <param name="Rotation"></param>
        /// <returns></returns>
        public static Matrix CreateRotationMatrix(Vector3 Rotation)
        {
            return Matrix.CreateFromYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z);
        }
    }
}
